//
//  MSAllListDataSource.m
//  MSJD
//
//  Created by 箭军刘 on 2018/10/24.
//  Copyright © 2018年 xiangbo. All rights reserved.
//

#import "MSAllListDataSource.h"

@implementation MSAllListDataSource

+ (void)queryFoodListDataWithUrl:(NSString *)url
                          FoodId:(NSInteger)foodId
                          kindId:(NSInteger)kindId
                            page:(NSInteger)page
                        pageSize:(NSInteger)pageSize
                         success:(void (^)(MSFoodNearbyData *responseInfo))success
                         failure:(void (^)(NSError *error))failure {
    if ([MSSafeObject isNull:url]) {
        url = @"v1/content/list";
    } else {
        if ([url containsString:@"/app/"]) {
            url = [url substringFromIndex:5];
        }
    }
    NSDictionary *param = @{@"mid":@(foodId), @"kid":@(kindId), @"page":@(page), @"size":@(pageSize)};
    [MSRequestClient GET:url parameters:param responseClassType:MSFoodNearbyResponse.class success:^(id responseObject) {
        MSFoodNearbyResponse *foodMoreResponse = (MSFoodNearbyResponse *)responseObject;
        if (success) {
            success(foodMoreResponse.data);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

@end
